home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- BorderStyle = 0 'None
- Caption = "Resource Bar"
- ClientHeight = 360
- ClientLeft = 3465
- ClientTop = 3615
- ClientWidth = 4200
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 12
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 765
- Icon = RES_MAIN.FRX:0000
- Left = 3405
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 360
- ScaleWidth = 4200
- Top = 3270
- Width = 4320
- Begin PictureBox Panel1
- BackColor = &H000000FF&
- Height = 1000
- Left = 0
- ScaleHeight = 975
- ScaleWidth = 975
- TabIndex = 0
- Top = 0
- Width = 1000
- Begin Timer Timer1
- Interval = 750
- Left = 0
- Top = 0
- End
- Begin Label Label1
- Alignment = 2 'Center
- BackColor = &H00C0C0C0&
- Caption = "--------- I N I T I A L I Z I N G ---------"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 255
- Left = 60
- TabIndex = 1
- Top = 65
- Width = 4075
- End
- End
- Sub Escape_Now ()
- 'Take away the ON TOP feature in case user has
- ' positioned "bar" in front of message box then
- ' put the question to them. Then either exit or reinstate
- ' the ON TOP feature.
- NotOnTop% = SetWindowPos(Form1.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
- Answer% = MsgBox("Terminate Resource Bar?", 36, "Resource Bar")
- If Answer% = 6 Then End
- If Answer% = 7 Then OnTop% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
- End Sub
- Sub Form_DragDrop (Source As Control, X As Single, Y As Single)
- 'Move form with mouse
- Call GetCursorPos(CurPos)
- Call ScreenToClient(Form1.hWnd, CurPos)
- NewPosX% = CurPos.X - MyPosX%
- NewPosY% = CurPos.Y - MyPosY%
- End Sub
- Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
- 'bring up the help or escape forms if asked
- If KeyCode = Escape Then Call Escape_Now
- If KeyCode = KEY_F1 Then Call Help_Me
- 'Move form around with arrow keys
- If KeyCode = DownArrow Then Form1.Top = Form1.Top + 300
- If KeyCode = UpArrow Then Form1.Top = Form1.Top - 300
- If KeyCode = RightArrow Then Form1.Left = Form1.Left + 300
- If KeyCode = LeftArrow Then Form1.Left = Form1.Left - 300
- End Sub
- Sub Form_Load ()
- NL$ = Chr$(13) + Chr$(10) 'carrage return for message boxes
- '-- Extract the Major and Minor revisions and build
- ' the version strings (this won't run in Win 3.0)
- I% = GetVersion()
- ' lowbyte is derived by masking off high byte
- lowbyte$ = Str$(I% And &HFF)
- ' highbyte is derived by masking off low byte and shifting
- highbyte$ = LTrim$(Str$((I% And &HFF00) / 256))
- ' assign windows version to text property
- CurrentVersion# = Val(lowbyte$ + "." + highbyte$)
- If CurrentVersion# < 3.1 Then
- MsgBox "This Program Must Have Windows" + NL$ + "Version 3.1 Or Higher", 16, "Resource Bar"
- End
- End If
- 'Position in lower right corner
- Form1.Top = Screen.Height - Form1.Height
- Form1.Left = Screen.Width - Form1.Width
- 'Stay on Top
- OnTop% = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
- FOCUS = True
- 'read .ini file
- 'Does user want BigBen,DING, or nothing at top of hour
- AppName$ = "RESOURCE BAR"
- KeyName$ = "TOPOFHOUR"
- DefltStr$ = "BIGBEN"
- Dim RetStr As String * 255
- RetStr$ = String$(255, 0)
- nSize% = 255
- FileName$ = "RESOURCE.INI"
- LngthOfRetStr% = GetPrivateProfileString(AppName$, KeyName$, DefltStr$, RetStr$, nSize%, FileName$)
- TopOfHour$ = UCase$(Left$(RetStr$, LngthOfRetStr%))
- 'Does user want DING or nothing at bottom of hour
- AppName$ = "RESOURCE BAR"
- KeyName$ = "BOTTOFHOUR"
- DefltStr$ = "DING"
- RetStr$ = String$(255, 0)
- nSize% = 255
- FileName$ = "RESOURCE.INI"
- LngthOfRetStr% = GetPrivateProfileString(AppName$, KeyName$, DefltStr$, RetStr$, nSize%, FileName$)
- BottOfHour$ = UCase$(Left$(RetStr$, LngthOfRetStr%))
- End Sub
- Sub Form_LostFocus ()
- Form1.Label1.BackColor = Grey
- Form1.Label1.ForeColor = Black
- Form1.Panel1.BackColor = Grey
- End Sub
- Sub Label1_Click ()
- FOCUS = True
- Form1.Label1.BackColor = Blue
- Form1.Label1.ForeColor = White
- Form1.Panel1.BackColor = Red
- End Sub
- Sub Label1_DblClick ()
- Form2.Show
- End Sub
- Sub Label1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Move form with mouse
- Call GetCursorPos(CurPos)
- Call ScreenToClient(Form1.hWnd, CurPos)
- MyPosX% = CurPos.X
- MyPosY% = CurPos.Y
- End Sub
- Sub Label1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Move form with mouse
- If Button = Left_Button Then
- Call GetCursorPos(CurPos)
- NewPosX% = CurPos.X - MyPosX%
- NewPosY% = CurPos.Y - MyPosY%
- 'Call origionally I put junk% =
- junk% = SetWindowPos(Form1.hWnd, 0, NewPosX%, NewPosY%, 0&, 0&, SWP_NOSIZE)
- End If
- End Sub
- Sub SaveIni (AppName$, IniFileName$, KeyName$, NewVal$)
- ' Update INI file
- ResultCode% = WritePrivateProfileString(AppName$, KeyName$, NewVal$, IniFileName$)
- If ResultCode% = 0 Then
- MsgBox "Error updating INI file!", 16, "ERROR!"
- End If
- End Sub
- Sub Timer1_Timer ()
- 'Gather info for bar
- SysRes% = GetFreeSystemResources(GFSR_SYSTEMRESOURCES)
- Memory& = GetFreeSpace(0)
- MemFree$ = Format$((Memory& / 1000), "#####") + " Kb,"
- 'Putting today's date and current time on the lable 1st, then the day, then the date, then the Kb, then the % Free
- Form1.Label1.Caption = Format$(Now, "h:mm:ss AM/PM") + ", " + Format$(Now, "ddd") + " " + Format$(Now, "m/d/yy") + " - " + MemFree$ + Str$(SysRes%) + "% Free"
- 'DING on the hour
- 'Check for top of hour
- If TopOfHour$ <> "NONE" Then 'If user didn't select "no
- ' sound" then continue
- If TopOfHour$ = "BIGBEN" Then
- Top1$ = "bigben"
- Top2$ = "ben"
- End If
- If TopOfHour$ = "DING" Then
- Top1$ = "ding"
- Top2$ = "ding"
- End If
- If Right$(Format$(Now, "h:mm:ss"), 5) = "00:00" Then
- The_Hour% = Val(Left$(Format$(Now, "h:mm am/pm"), 2))
- The_Hour% = The_Hour% - 1 'allow for the "windup chime" vs "reg. chime"
- result1% = SndPlaySound(Top1$ + ".wav", 0)
- For I% = 1 To The_Hour%
- result2% = SndPlaySound(Top2$ + ".wav", 0)
- Next I%
- End If
- End If
- 'DING on 1/2 hr
- If BottOfHour$ <> "NONE" Then 'If user didn't select "no
- ' sound" then continue
- 'check for the bott. of hour
- If Mid$(Format$(Now, "hh:mm:ss"), 4, 5) = "30:00" Then
- result3% = SndPlaySound("ding.wav", 0)
- End If
- End If
- 'Watch when form loses focus
- If FOCUS = True Then
- ' Compare the handle of the currently active Window
- ' with the handle of the Form1 window:
- If GetActiveWindow() <> Form1.hWnd Then
- 'Do form's lost-focus routines here.
- Call Form_LostFocus
- FOCUS = False
- End If
- End If
- End Sub
-